package com.roncoo.example.controller;

import java.util.HashMap;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api")
public class ApiController {

  private static Logger logger = LoggerFactory.getLogger(ApiController.class);
	@CrossOrigin(origins = "http://localhost:8080")
	@RequestMapping(value = "/get", method = {RequestMethod.GET,RequestMethod.POST})
	public HashMap<String, Object> get(@RequestParam String name) {
		HashMap<String, Object> map = new HashMap<String, Object>();
    map.put("title", "hello world==>" + name);
		map.put("name", name);
    logger.info("name===>" + name);

    org.springframework.http.RequestEntity r;

		return map;
	}

}
